<%--
  Created by IntelliJ IDEA.
  User: zhaott
  Date: 2022/3/21
  Time: 11:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.12.4.min.js"></script>
</head>
<body>
    <p id="person"></p>
    <table>
        <tr><td>姓名</td><td>年龄</td><td>性别</td></tr>
    </table>
    <script>
        //JSON格式的对象
        var person={"name":"张三","age":23,"gender":"男"};
        //JSON格式的数组
        var citys=["郑州","北京","上海"];
        //JSON格式的对象数组
        var persons=[
            {"name":"张三","age":23,"gender":"男"},
            {"name":"李四","age":24,"gender":"女"},
            {"name":"王五","age":22,"gender":"男"}
        ];
        $("#person").html("姓名："+person.name+",age:"+person.age+",gender:"+person.gender);
        $(persons).each(function(m,n){
            var str=" <tr><td>"+n.name+"</td><td>"+n.age+"</td><td>"+n.gender+"</td></tr>";
            $("table").append(str);
        })
    </script>
</body>
</html>
